﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPageMain.Master" AutoEventWireup="true" CodeBehind="ManageUsers.aspx.cs" Inherits="PersonalFinanceManager.Website.ManageUsers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderMain" runat="server">
    <div class="content">
        <h2><span>Кориснички профили</span></h2>
        <hr />
        
        

        <div class="mainbar">
                <div style="float:right;padding-right:10px;">
                    <asp:Panel runat="server" ID="pnlSearch" GroupingText="Пребарување" DefaultButton="btnSearch">
                        <asp:TextBox ID="txtSearch" runat="server" Width="200px" />
                        &nbsp;<asp:Button ID="btnSearch" runat="server" Text="Барај" 
                            onclick="btnSearch_Click" />
                    </asp:Panel>
                </div>
                <div class="clr"></div>

                <div>
                <p class="post-data">
                    <asp:GridView runat="server" ID="gvUsers" AutoGenerateColumns="false"  DataKeyNames="ID"
                        onrowdeleting="gvUsers_RowDeleting" 
                        onselectedindexchanged="gvUsers_SelectedIndexChanged">
                        <EmptyDataTemplate>
                            -- Нема податоци --
                        </EmptyDataTemplate>


                        <Columns>
                            <asp:BoundField DataField="FirstName" HeaderText="Име" />
                            <asp:BoundField DataField="Surname" HeaderText="Презиме" />
                            <asp:BoundField DataField="Username" HeaderText="Корисничко име" ReadOnly="true" />
                            <asp:BoundField DataField="Password" HeaderText="Лозинка" />
                            <asp:BoundField DataField="Email" HeaderText="E-mail" />
                            <asp:BoundField DataField="RegistrationDate" HeaderText="Датум регистрација" ReadOnly="true" />

                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:LinkButton runat="server" ID="btnEdit" CommandName="Select" Text="промени" />
                                </ItemTemplate>
                                <ItemStyle Width="65px" ForeColor="Blue" HorizontalAlign="Center" />
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:LinkButton runat="server" ID="btnDelete" CommandName="Delete" Text="избриши"
                                        OnClientClick='<%# "return confirm(\"Избриши запис? \")" %>' />
                                </ItemTemplate>
                                <ItemStyle Width="60px" ForeColor="Red" HorizontalAlign="Center" />
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>

                    <span>
                        <b>Број на записи:</b>&nbsp;
                        <asp:Label runat="server" ID="lblTotalCount" />
                    </span>
                </p>
                </div>
        </div>


        <div class="sidebar">
            <div class="gadget">
                <asp:Panel ID="pnlUsers" runat="server" GroupingText="Внеси корисник" DefaultButton="btnInsert" >
                    <table>
                        <tr>
                            <td>Име:</td>
                            <td><asp:TextBox runat="server" ID="txtFirstName" /></td>
                        </tr>
                        <tr>
                            <td>Презиме:</td>
                            <td><asp:TextBox runat="server" ID="txtSurname" /></td>
                        </tr>
                        <tr>
                            <td>Корисничко име:</td>
                            <td><asp:TextBox runat="server" ID="txtUsername" /></td>
                        </tr>
                        <tr>
                            <td>Лозинка:</td>
                            <td><asp:TextBox runat="server" ID="txtPassword" /></td>
                        </tr>
                        <tr>
                            <td>E-mail:</td>
                            <td><asp:TextBox runat="server" ID="txtEmail" /></td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div style="float:right;padding-top:10px;">
                                    <asp:Button runat="server" ID="btnInsert" Text="Внеси" ValidationGroup="group1" Font-Bold="true"
                                        onclick="btnInsert_Click" />
                                    <asp:Button runat="server" ID="btnUpdate" Text="Измени" ValidationGroup="group1" Font-Bold="true"
                                        onclick="btnUpdate_Click" />
                                    &nbsp;
                                    <asp:Button runat="server" ID="btnCancel" Text="Откажи" 
                                        onclick="btnCancel_Click" />
                                </div>
                            </td>
                        </tr>
                    </table>

                    <div>
                        <ul style="list-style-type:disc;margin-left:20px;">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ValidationGroup="group1" Display="Dynamic" ControlToValidate="txtFirstName" Text="<li>Полето 'Име' е задолжително</li>" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ValidationGroup="group1" Display="Dynamic" ControlToValidate="txtSurname" Text="<li>Полето 'Презиме' е задолжително</li>"/>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ValidationGroup="group1" Display="Dynamic" ControlToValidate="txtUsername" Text="<li>Полето 'Корисничко име' е задолжително</li>"/>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ValidationGroup="group1" Display="Dynamic" ControlToValidate="txtPassword" Text="<li>Полето 'Лозинка' е задолжително</li>"/>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ValidationGroup="group1" Display="Dynamic" ControlToValidate="txtEmail" Text="<li>Полето 'E-mail' е задолжително</li>" />
                        </ul>
                    </div>
                </asp:Panel>
            </div>
        </div>
        <div class="clr"></div>
    </div>
</asp:Content>
